<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工厂模式</title>
</head>
<body>
  <script>
      //1工厂应该有厂长来决定运行到底哪条产品线
      //2.消费者-》子类
      var gongchang={};
      gongchang.chanyifu=function(){
          this.gongren=100
          alert('我们有'+this.gongren)
      };
      gongchang.chanxie=function(){
         this.gongren=200
          alert('产鞋子'+this.gongren)
      };
      gongchang.yunshu=function(){
          this.gongren=300
          alert('运输'+this.gongren)
      };
      gongchang.changzhang=function(para){
          return new gongchang[para]();
      }
      var me=gongchang.changzhang("chanxie")
      alert(me.gongren)
  </script>
</body>
</html>